package com.Smart.smartscals.Fragment;

import java.util.ArrayList;

import org.apache.http.client.CircularRedirectException;

import com.Smart.smartscals.Activity.R;
import com.Smart.smartscals.Adapter.MainListAdapter;
import com.Smart.smartscals.CustomView.CustomCircleView;
import com.Smart.smartscals.Entity.EntityCircleView;
import com.Smart.smartscals.Entity.EntityListView;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class FragmentMainName extends BaseFragment {

	private EntityCircleView mEntityCircleView;
	private CustomCircleView mCircleView1, mCircleView2, mCircleView3;

	// 显示的ListView
	private ListView mListView;
	private MainListAdapter mBaseAdapter;
	private ArrayList<EntityListView> arrayListEntityListViews;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mView = inflater.inflate(R.layout.fragment_main_name, null);
		// TODO Auto-generated method stub
		return mView;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		initView();
		initParam();
	}

	private void initParam() {
		
		arrayListEntityListViews = new ArrayList<EntityListView>();
		EntityListView entityListView = new EntityListView(R.drawable.main_bmricon,"肌肉率" , "异常", "100%");
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		arrayListEntityListViews.add(entityListView);
		mBaseAdapter = new MainListAdapter(mListView,arrayListEntityListViews, this.getActivity());
		mListView.setAdapter(mBaseAdapter);
		
		
	}

	private void initView() {
		mCircleView1 = (CustomCircleView) mView
				.findViewById(R.id.man_circleview_1);
		mCircleView2 = (CustomCircleView) mView
				.findViewById(R.id.man_circleview_2);
		mCircleView3 = (CustomCircleView) mView
				.findViewById(R.id.man_circleview_3);

		mEntityCircleView = new EntityCircleView("955.0", "现在", "斤", "太胖了");

		mCircleView1.initParam(mEntityCircleView);
//		mCircleView1.statAniMation();

		mCircleView2.initParam(mEntityCircleView);
//		mCircleView2.statAniMation();
		
		mListView = (ListView) mView.findViewById(R.id.main_name_list);

		mCircleView3.initParam(mEntityCircleView);
//		mCircleView3.statAniMation();
	}
}
